Skip to content

Revert "nbd: freeze the queue while we're adding connections"#886

Open
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1100929=>linus-master
Open

Revert "nbd: freeze the queue while we're adding connections"#886
blktests-ci[bot] wants to merge 1 commit into
linus-master_basefrom
series/1100929=>linus-master

Conversation

@blktests-ci

@blktests-ci blktests-ci Bot commented May 26, 2026

Copy link
Copy Markdown

Pull request for series with
subject: Revert "nbd: freeze the queue while we're adding connections"
version: 1
url: https://patchwork.kernel.org/project/linux-block/list/?series=1100929

@blktests-ci

blktests-ci Bot commented May 26, 2026

Copy link
Copy Markdown
Author

Upstream branch: eed108e
series: https://patchwork.kernel.org/project/linux-block/list/?series=1100929
version: 1

@blktests-ci

blktests-ci Bot commented May 26, 2026

Copy link
Copy Markdown
Author

Upstream branch: e8c2f9f
series: https://patchwork.kernel.org/project/linux-block/list/?series=1100929
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1100929=>linus-master branch from 3ce8dc4 to 7b1d886 Compare May 26, 2026 15:42
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 86d8d37 to 9805659 Compare May 28, 2026 13:24
@blktests-ci

blktests-ci Bot commented May 28, 2026

Copy link
Copy Markdown
Author

Upstream branch: eb3f4b7
series: https://patchwork.kernel.org/project/linux-block/list/?series=1100929
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1100929=>linus-master branch from 7b1d886 to c496e42 Compare May 28, 2026 13:28
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 9805659 to 3f4a345 Compare May 29, 2026 11:12
@blktests-ci

blktests-ci Bot commented May 29, 2026

Copy link
Copy Markdown
Author

Upstream branch: 8fde5d1
series: https://patchwork.kernel.org/project/linux-block/list/?series=1100929
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1100929=>linus-master branch from c496e42 to 6eb8dbf Compare May 29, 2026 11:15
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 3f4a345 to c6dc343 Compare June 1, 2026 08:57
@blktests-ci

blktests-ci Bot commented Jun 1, 2026

Copy link
Copy Markdown
Author

Upstream branch: e43ffb6
series: https://patchwork.kernel.org/project/linux-block/list/?series=1100929
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1100929=>linus-master branch from 6eb8dbf to 760c820 Compare June 1, 2026 09:00
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from c6dc343 to fc36596 Compare June 3, 2026 13:56
@blktests-ci

blktests-ci Bot commented Jun 3, 2026

Copy link
Copy Markdown
Author

Upstream branch: ba3e43a
series: https://patchwork.kernel.org/project/linux-block/list/?series=1100929
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1100929=>linus-master branch from 760c820 to b6ca782 Compare June 3, 2026 14:31
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from fc36596 to 7bed9c3 Compare June 5, 2026 09:48
@blktests-ci

blktests-ci Bot commented Jun 5, 2026

Copy link
Copy Markdown
Author

Upstream branch: ddd664b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1100929
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1100929=>linus-master branch from b6ca782 to 0e0f395 Compare June 5, 2026 10:19
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 7bed9c3 to a7bb5c5 Compare June 7, 2026 14:54
@blktests-ci

blktests-ci Bot commented Jun 7, 2026

Copy link
Copy Markdown
Author

Upstream branch: 979c294
series: https://patchwork.kernel.org/project/linux-block/list/?series=1100929
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1100929=>linus-master branch from 0e0f395 to ae4a79e Compare June 7, 2026 15:29
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from a7bb5c5 to 5e41a3b Compare June 10, 2026 13:31
@blktests-ci

blktests-ci Bot commented Jun 10, 2026

Copy link
Copy Markdown
Author

Upstream branch: acb7500
series: https://patchwork.kernel.org/project/linux-block/list/?series=1100929
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1100929=>linus-master branch from ae4a79e to c734978 Compare June 10, 2026 14:14
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 5e41a3b to c3a084b Compare June 10, 2026 20:26
@blktests-ci

blktests-ci Bot commented Jun 11, 2026

Copy link
Copy Markdown
Author

Upstream branch: 9716c08
series: https://patchwork.kernel.org/project/linux-block/list/?series=1100929
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1100929=>linus-master branch from c734978 to aa3d627 Compare June 11, 2026 09:46
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from c3a084b to 5f78e5d Compare June 12, 2026 22:27
@blktests-ci

blktests-ci Bot commented Jun 12, 2026

Copy link
Copy Markdown
Author

Upstream branch: 2a2974b
series: https://patchwork.kernel.org/project/linux-block/list/?series=1100929
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1100929=>linus-master branch from aa3d627 to 7ada834 Compare June 12, 2026 23:12
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from 5f78e5d to e48f9db Compare June 13, 2026 01:19
@blktests-ci

blktests-ci Bot commented Jun 13, 2026

Copy link
Copy Markdown
Author

Upstream branch: 062871f
series: https://patchwork.kernel.org/project/linux-block/list/?series=1100929
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1100929=>linus-master branch from 7ada834 to 5725313 Compare June 13, 2026 02:09
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch 2 times, most recently from 199644a to e6d9eb8 Compare June 17, 2026 12:02
@blktests-ci

blktests-ci Bot commented Jun 17, 2026

Copy link
Copy Markdown
Author

Upstream branch: 66affa3
series: https://patchwork.kernel.org/project/linux-block/list/?series=1100929
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1100929=>linus-master branch from 5725313 to 8c461d7 Compare June 17, 2026 15:18
@blktests-ci blktests-ci Bot force-pushed the linus-master_base branch from e6d9eb8 to 7d8604f Compare June 24, 2026 01:11
This reverts commit b98e762.

Commit b98e762 ("nbd: freeze the queue while we're adding
connections") added blk_mq_freeze_queue/blk_mq_unfreeze_queue in
nbd_add_socket() to protect krealloc(config->socks) from concurrent I/O
that could cause a Use-After-Free.

However, analysis shows that in all current code paths, concurrent I/O
cannot actually reach nbd_add_socket():

1. nbd_genl_connect() path:
   nbd_add_socket() is called first, and nbd_start_device() -- which
   starts the queue and enables I/O -- is called only after all sockets
   have been added. So the freeze/unfreeze runs against an idle queue,
   marking then waiting on a percpu_ref that is already zero, and then
   resurrecting it -- a pure no-op that burns an RCU grace period per
   socket on multi-core systems.

2. nbd_ioctl(NBD_SET_SOCK) path:
   The task_setup check enforces that only the thread which performed
   the first NBD_SET_SOCK can call NBD_SET_SOCK again. That thread is
   blocked in NBD_DO_IT's wait_event_interruptible, so it cannot issue
   another NBD_SET_SOCK concurrently with I/O. Other threads are
   rejected by the task_setup != current check.

3. nbd_genl_reconfigure() does not call nbd_add_socket() at all; it
   uses nbd_reconnect_socket() which replaces a dead socket in-place
   without reallocating config->socks.

Therefore the freeze/unfreeze provides no actual protection in any
reachable code path, while imposing the cost of blk_mq_freeze_queue
(percpu_ref_kill + RCU grace period wait + percpu_ref_resurrect) on
every socket addition during device setup[1].

Revert the change to eliminate the unnecessary overhead.

Link: https://lore.kernel.org/all/20260327091223.4147956-1-leo.lilong@huaweicloud.com/ [1]
Signed-off-by: Yang Erkun <yangerkun@huawei.com>
@blktests-ci

blktests-ci Bot commented Jun 24, 2026

Copy link
Copy Markdown
Author

Upstream branch: bade58e
series: https://patchwork.kernel.org/project/linux-block/list/?series=1100929
version: 1

@blktests-ci blktests-ci Bot force-pushed the series/1100929=>linus-master branch from 8c461d7 to 999e524 Compare June 24, 2026 01:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants